package com.gmzg.gmzgoffice.works.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.gmzg.gmzgoffice.works.ApproveFragment;

import java.util.List;

/**
 * author: GD on 2016/11/8 22:44
 * email :2301722691@qq.com
 */

public class ViewPagerAdapter extends FragmentPagerAdapter {
    private List<ApproveFragment> mFragmentList;

    public ViewPagerAdapter(FragmentManager fm, List<ApproveFragment> fragmentList) {
        super(fm);
        mFragmentList = fragmentList;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        if (mFragmentList != null) {
            return mFragmentList.size();
        }
        return 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 0:
                return "待我审核的";
            case 1:
                return "我已审批的";
            case 2:
                return "我发起的";
        }
        return "";
    }
}
